package com.atguigu.gmall.product.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.product.SkuInfo;
import com.atguigu.gmall.product.service.SkuInfoService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author:hrh
 * @create: 2022-11-05 08:54
 * @Description: Sku操作相关的类
 */
@Api ("商品Sku管理相关")
@RestController
@RequestMapping ("/admin/product")
public class SkuController {

    @Autowired
    SkuInfoService skuInfoService;

    /**
     * 分页批量查询Sku信息
     *
     * @param pn：页码
     * @param pz：每页数量
     * @return ：Sku分页信息
     */
    @ApiOperation ("分页批量查询Sku信息")
    @GetMapping ("/list/{pn}/{pz}")
    public Result getList (@PathVariable Long pn, @PathVariable Long pz) {
        Page<SkuInfo> skuInfos = this.skuInfoService.getList (pn, pz);
        return Result.ok (skuInfos);
    }
}
